<template>
  <div class="editMyinfo">
    <van-nav-bar
      title="修改个人信息"
      right-text="保存"
      @click-right="baocun"
      left-arrow
      @click-left="$router.back()"
    />
    <van-cell-group inset>
      <van-field v-model="store.res.user_nickname" placeholder="请输入昵称" />
    </van-cell-group>
  </div>
</template>

<script setup>
import { ref, reactive, toRefs } from "vue";
import { useCounterStore } from "@/stores/counter";
import { editUserNameApi } from "@/http/api";
import { useRouter } from "vue-router";
const router = useRouter();
const store = useCounterStore();
const baocun = async () => {
  console.log(store.res.id);
  console.log(store.res.user_nickname);
  const res = await editUserNameApi({
    id: store.res.id,
    user_nickname: store.res.user_nickname,
  });
  console.log(res);
  if (res.code == 200) {
    router.back();
  }
};
</script>
<style lang="scss" scoped></style>
